package com.example.websocket.pattern.creational.factory.factoryPattern;

import com.example.websocket.pattern.creational.factory.factoryPattern.line.Circle;
import com.example.websocket.pattern.creational.factory.factoryPattern.line.Rectangle;
import com.example.websocket.pattern.creational.factory.factoryPattern.line.Shape;
import com.example.websocket.pattern.creational.factory.factoryPattern.line.Square;

// shape工厂
public class ShapeFactory {

    public Shape getShape(String shapeType){
        if (shapeType == null) {
            return null;
        } else if (shapeType.contains("CIRCLE")) {
            return new Circle();
        } else if (shapeType.contains("SQUARE")) {
            return new Square();
        } else if (shapeType.contains("RECTANGLE")) {
            return new Rectangle();
        }
        return null;
    }

}
